<template>
  <div class="wrap">
    <div class="introduce">
      <h2>伊娃V5-轻量级权限系统</h2>
      <h3>金镐开源组织研发，开源免费无版权！</h3>
    </div>
    <!-- v5.1.0，新增style，根据主题定义切换样式 -->
    <div class="login" :style="loginStyle">
      <LoginForm @success="handleSuccess"/>
    </div>
  </div>
</template>

<script>
import LoginForm from '@/components/system/LoginForm'
import Theme from '@/core/utils/theme'

export default {
  name: 'Login',
  components: { LoginForm },
  computed: {
    // v5.1.0，计算右侧登录style
    loginStyle () {
      // 开启了主题，则通过主题配置计算样式
      if (this.$theme.enabled) {
        return {
          backgroundColor: Theme.rgba(Theme.getSettings().lightColor, 0.99)
        }
      }
      return {}
    }
  },
  methods: {
    /**
     * 登录成功
     */
    handleSuccess() {
      this.$router.push(import.meta.env.VITE_APP_CONTEXT_PATH)
    }
  }
}
</script>

<style scoped lang="scss">
.wrap {
  display: flex;
  width: 100%;
  min-width: 1200px;
  height: 100vh;
  background-image: url("/public/images/login.jpg");
  background-repeat: no-repeat;
  background-size: auto 180%;
  background-clip: content-box;
  background-position: center;
  // 左边介绍
  .introduce {
    padding-left: 10%;
    padding-right: 50px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;

    h2 {
      font-size: 45px;
      font-style: italic;
      font-weight: 900;
      margin-top: 50px;
    }

    h3 {
      font-size: 35px;
      font-weight: 300;
      margin: 25px 0;
    }
  }

  // 右边登录
  .login {
    height: 100%;
    width: 45%;
    min-width: 700px;
    max-width: 800px;
    flex-shrink: 0;
    text-align: center;
    background: rgba(255, 255, 255, .99);
    padding: 0 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
  }
}
</style>
